﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnitTest
{
    public class Unit_03
    {

        public static void Go()
        {
            int[] arr = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
            ConcurrentBag<int> ss = new ConcurrentBag<int>();
            Parallel.ForEach(arr, new ParallelOptions { MaxDegreeOfParallelism = 3 }, item =>
             {
                 
             });
        }

        public static List<int> Add()
        {
            int page = 1;
            List<int> list = new List<int>();
            for (int i = 0; i < 50; i++)
            {
                page++;
                var res= test();
                list.Add(res);
            }

            return list;
        }

        public static int test()
        {
            Task.Delay(300);
            return 1;
        }
    }
}
